/**
*      author: Y_Yao
*      created: 2024-10-06 18:31:05
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;
LL a[N];

void solve()
{
    LL n;
    cin >> n;
    LL total = 0;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        total += a[i];
    }
    if(n == 1 || n == 2)
    {
        cout << "-1" << endl;
        return;
    }

    sort(a+1,a+n+1);

    LL mid = (n + 2) / 2;
    LL tmp = a[mid] * n * 2;
    LL x = tmp - total + 1;
    if(x < 0) x = 0;
    cout << x << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}